#{extends 'frame.html' /}
#{set title:'我的任务' /}

#{set 'moreStyles'}
<link rel="stylesheet" media="screen" href="@{'/public/stylesheets/task/buyerTasks.css'}" />
<link rel="stylesheet" media="screen" href="@{'/public/stylesheets/jquery.pagination.css'}" />
<link rel="stylesheet" media="screen" href="@{'/public/stylesheets/datePicker.css'}" />
#{/set}
<div class="contentCard">
	<div class="contentTitle">
	    <span class="floatRight mr20">
	    	<a href="/tasks" class="red"><em class="iconfont">&#xf0035;</em>我要做任务</a>
	    </span>
	    <span class="floatLeft">待处理任务</span>
	</div>
	<div class="contentBody">
		<div class="overview-wrapper clearfix">
			<div class="overview-box floatLeft">
				<div class="caption secondTile">已接手，待付款</div>
				#{if waitingTaskInfoMap.get('recieved')}
				<div class="num-list">
					#{list items:waitingTaskInfoMap.get('recieved'), as:'vo'}
					<span class="item">
						<span class="selectCell" platform="${vo.platform}" status="_RECIEVED">
							${vo.platform.title} <strong>${vo.count}</strong>
						</span>
					</span>
					#{/list}
				</div>
				#{/if}
				#{else}
				<div class="no-data">暂无待处理的任务</div>
				#{/else}
				<div class="info">
					<span class="iconfont">&#xf0142;</span>
					请尽快开始并在要求时间内完成
				</div>
			</div>
			<div class="overview-box floatLeft">
				<div class="caption secondTile">快递单已打印，待确认收货</div>
				#{if waitingTaskInfoMap.get('WAIT_CONFIRM')}
				<div class="num-list">
					#{list items:waitingTaskInfoMap.get('WAIT_CONFIRM'), as:'vo'}
					<a href="/buyer/task/confirmGoods/${vo.platform}">
						<span class="item">
							<span>${vo.platform.title}</span> <strong>${vo.count}</strong>
						</span>
					</a>
					#{/list}
				</div>
				#{/if}
				#{else}
				<div class="no-data">暂无待处理的任务</div>
				#{/else}
				<div class="info">
					<span class="iconfont">&#xf0142;</span>
					请待快递状态变为已签收后再确认收货并好评
				</div>
			</div>
			<div class="overview-box floatLeft">
				<div class="caption secondTile">商家已返款，等待买手确认</div>
				#{if waitingTaskInfoMap.get('REFUNDING')}
				<div class="num-list">
					#{list items:waitingTaskInfoMap.get('REFUNDING'), as:'vo'}
					<a href="/buyer/task/verifyRefund?platform=${vo.platform}" class="item">
						<span class="item">
							<span>${vo.platform.title}</span>
							<strong>${vo.count}</strong>
						</span>
					</a>
					#{/list}
				</div>
				#{/if}
				#{if waitSysRefund>0}
				<div class="num-list">
					<a href="/buyer/tasks/sysRefund" class="item">
						<span class="item">
							<span>平台返款</span>
							<strong>${waitSysRefund}</strong>
						</span>
					</a>
				</div>
				#{/if}
				#{ifnot waitingTaskInfoMap.get('REFUNDING') || waitSysRefund>0}
					<div class="no-data">暂无待处理的任务</div>
				#{/ifnot}
				<div class="info">
					<span class="iconfont">&#xf0142;</span>
					商家预计在48小时内返款完毕，请等待返款到账
				</div>
			</div>
		</div>
	</div>
</div>

<div class="contentCard">
	<div class="contentTitle">任务进展</div>
	<div class="tabSwitchWrapper">
		<a class="tab-cell chargeTypeTab focus" href="javascript:;" data-status="PROCESS" for="processingTask">进行中的任务</a>
		<a class="tab-cell chargeTypeTab" href="javascript:;" data-status="FINISHED" for="finishedTask">已完成的任务</a>
		<a class="tab-cell chargeTypeTab" href="javascript:;" data-status="CANCEL" for="cancelTask">已经取消的任务</a>
		<a class="tab-cell chargeTypeTab" href="javascript:;" data-status="ALL" for="allTask">全部任务</a>
	</div>
	<div id="taskFilterPanel">
		<div class="clearfix mb10">
			<span class="floatLeft mr10">平台</span>
			<select class="floatLeft mr-8" id="platform">
				<option value="">全部</option>
				#{list items:Platforms, as:'p'}
				<option value="${p}">${p.title}</option>
				#{/list}
			</select>
			<span class="floatLeft mr-8">买号</span>
			<select class="floatLeft mr-8" id="buyerAccountId">
				<option value="">全部</option>
			</select>
			<span class="floatLeft mr-8">任务状态</span>
			<select class="floatLeft mr-8" style="width:230px;" id="status">
				<option value="">全部</option>
				<option value="RECIEVED">已接手，待开始</option>
				<option value="WAIT_PAY">已接手，待付款</option>
				<option value="_RECIEVED">已接手，待开始、待付款</option>
				<option value="_WAIT_SEND_GOODS">已付款，待发货</option>
				<option value="WAIT_CONFIRM">快递单已打印，待收货</option>
				<option value="WAIT_REFUND">已收货，待返款</option>
				<option value="REFUNDING">极速返款中，请等待返款到账</option>
				<option value="_FINISHED">已完成</option>
				<option value="CANCLED">已取消</option>
			</select>
			<span class="floatLeft mr-8">接手任务时间</span>
			<span class="floatLeft mr10 cal-date-input">
				<input class="inputDate start-date" id="takeTimeStart" readonly="readonly" value=""  />
			</span>
			<span class="floatLeft mr10 med-cal-split">-</span>
			<span class="floatLeft mr10 cal-date-input">
				<input class="inputDate end-date" id="takeTimeEnd" readonly="readonly" value="" />
			</span>
		</div>
		<div class="clearfix mb10">
			<span class="floatLeft mr10">订单编号</span>
			<input type="text" id="orderId" class="floatLeft mr10 inputText" />
			<span class="floatLeft mr10">任务编号</span>
			<input type="text" id="taskId" class="floatLeft mr10 inputText" />
			<span class="floatLeft mr10">子任务编号</span>
			<input type="text" id="id" class="floatLeft mr10 inputText" />
			<a class="stdColorButton floatLeft" href="javascript:;" id="queryBtn">查询</a>
		</div>
	</div>
	
	
	<div class="">
		<div class="taskWrapper" style="overflow: hidden;" id="taskContainer"></div>
		<!--这里是分页区域-->
		<div class="pagin-btm clearFix"style="display: none;">
			<div class="pagination"></div>
		</div>
		<input type="hidden" id="durex_data" value="" />
		<div class="popWrapper" style="display: none;" id="tr_loading_mask">
			<div class="maskLayer"></div>
			<img class="tr_juhua" src="@{'/public/images/pre_loading.gif'}" />
		</div>
		<div class="taskPagination"></div>
	</div>
</div>

<!-- 任务展现模板 -->
<textarea id="taskCellTemp" class="muban">
	{{#results}}
	<div class="taskCell {{#sysRefund}}withdrawImg{{/sysRefund}} {{^sysRefund}}withdImg{{/sysRefund}}">
		<div class="title " >
			
			<span class="taskNo floatRight">
				接手时间：{{taketime}}
				任务编号：{{taskIdStr}}-{{id}}
				<a target="_blank" href="/buyer/task/{{id}}" class="view-detail">[查看详情]</a>
			</span>
			<span class="floatRight mr-20">
				<a target="_blank" href="{{staUrl}}" class="view-detail">{{staActive}}</a>
			</span>
			<span class="shop"> <i class="plat_small {{platIcon}}"></i>
				{{shopName}}**********
			</span>
			
		</div>
		<div class="body">
			<table class="normTable">
				<thead>
					<tr>
						<td class="item-list"></td>
						<td class="nick"></td>
						<td class="price"></td>
						<td class="commission"></td>
						<td class="commission"></td>
						<td class="status"></td>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td class="item-list">
							<div class="item-box">
								<div class="pic">
									<img src="{{itemPic}}" />
								</div>
							</div>
						</td>
						<td class="nick"> <em class="cap">买号</em>
							{{buyerAccountNick}}
						</td>
						<td class="price"> <em class="cap">垫付资金</em>
							{{paidFeeStr}}元
						</td>
						<td class="commission">
							<em class="cap">佣金</em>
							{{commission}}点
						</td>
						<td class="commission">
							<em class="cap">快递类型</em>
							<span class="green">{{expressTypeStr}}</span>
						</td>
						<td class="status">
							<span>
								<a href="javascript:;" class="view-detail cancel" btId="{{id}}">{{statusAction}}</a>
							</span>
							<em>{{statusTitle}}</em>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
	{{/results}}
</textarea>

<textarea id="accountTemp" class="muban">
	{{#results}}
	<option value="{{id}}">{{nick}}</option>
	{{/results}}
</textarea>
#{authenticityToken/}
#{set 'moreScripts'}
<script src="@{'/public/javascripts/date.js'}" type="text/javascript"></script>
<script src="@{'/public/javascripts/jquery.datePicker.js'}" type="text/javascript"></script>
<script src="@{'/public/javascripts/mustache.min.js'}" type="text/javascript"></script>
<script src="@{'/public/javascripts/jquery.number.min.js'}" type="text/javascript"></script>
<script src="@{'/public/javascripts/jquery.pagination.js'}" type="text/javascript"></script>
<script src="@{'/public/javascripts/task/buyerTasks.js'}" type="text/javascript"></script>
<script type="text/javascript">
	App.module = 'myTask';
	// App.drivel = 'bb';
</script>
#{/set}